// pages/classify/index.js
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    LeftMenuList:[],
    RightMenuList:[],
    idx:0,
    scrolltop:0,
  },
  
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    let LeftMenuList = app.globalData.Cates.map(v=>v.name)//获取app中预先加载的数据并赋值
    let RightMenuList = app.globalData.Cates[0].children
    this.setData({
      LeftMenuList:LeftMenuList,
      RightMenuList:RightMenuList
    })
    
  },
  handItem(e){
    //点击左侧对应分类时切换数据
    const index =e.currentTarget.dataset.index
    this.setData({
     idx:index,
     RightMenuList:app.globalData.Cates[index].children,
     scrolltop:0
    })
  },

})